﻿using System.Web.Mvc;

namespace OpusSuite.Controllers
{
    public class HomeController : Controller
    {
        [Attributes.AllowAnonymous]
        public ActionResult Confused()
        {
            return View();
        }

        [Attributes.AllowAnonymous]
        public ActionResult Error()
        {
            return View();
        }
        
        public ActionResult Index()
        {
            if (System.IO.File.Exists(Request.MapPath("~/App_Data/setupneeded.txt")))
                return RedirectToAction("Setup", "AccountAdmin");

            if (Request.IsAuthenticated)
            {
                return RedirectToAction(System.IO.File.Exists(Request.MapPath("~/App_Data/firsttime.txt")) ? "FirstTime" : "Dashboard", "AccountAdmin");
            }

            return RedirectToAction("LogOn", "AccountAdmin");
        }
    }
}
